package com.example.demo_yunpan.service.impl;

import com.example.demo_yunpan.entity.recycle;
import com.example.demo_yunpan.mapper.FileMapper;
import com.example.demo_yunpan.mapper.RecycleMapper;
import com.example.demo_yunpan.service.RecycleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecycleServiceImpl implements RecycleService {

    @Autowired
    RecycleMapper recycleMapper;
    @Autowired
    FileMapper fileMapper;
    @Override
    public List<recycle> getRecycleById(String userId) {
        //检查userId是否传值成功
        System.out.println(userId);
        return recycleMapper.getRecycleById(userId);
    }

    @Override
    public boolean delRecycleFile(String fileId) {

        return recycleMapper.deleteRecycleFile(fileId);
    }

    @Override
    public boolean RestoreRecycleFile(String fileId) {
        recycleMapper.deleteRecycleFile(fileId);
        return fileMapper.upFileMarkFalse(fileId);
    }
}
